<template>
  <div class="brandList">
    <div class="title">
      <span>品牌商直供</span>
      <span class="more">更多品牌商<span>></span></span>
    </div>
    <div class="box">
      <div
        class="item"
        v-for="item in brandList"
        :key="item.id"
        @click="skip(item.id)"
      >
        <img :src="item.picUrl" />
        <i>{{ item.name }}</i>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

//使用路由
const router = useRouter()

defineProps(['brandList'])

//跳转详情页
let skip = (id) => {
  // console.log(id)

  router.push({
    name: 'detail',
    params: { id }
  })
}
</script>

<style scoped>
.brandList {
  background-color: #fff;
}
.title {
  width: 90%;
  margin: 0 auto;
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
}
.box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 20px;
  margin: 10px;
}
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
img {
  width: 75%;
  margin: 20px 0 0 0;
} 
.more{
  font-size: 14px;
  color: gray;
}
</style>
